package cn.yunhe.test;

import cn.yunhe.biz.PhoneBiz;
import cn.yunhe.exception.OutOfStockException;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Demo1 {
    ApplicationContext ac=null;

    @Before
    public void init(){
        ac=new  ClassPathXmlApplicationContext("spring.xml");
    }

    @Test
    public void beforeTest() throws OutOfStockException {
      PhoneBiz phoneBiz= (PhoneBiz) ac.getBean("phoneBizImpl");
        phoneBiz.butPhone(500);
        phoneBiz.salePhone(300);
        System.out.println(phoneBiz.getClass().getName());
    }

}
